home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gekkan Dennou Club 142
/
Gekkan Dennou Club - 2000.3 Vol. 142 (Japan).7z
/
Gekkan Dennou Club - 2000.3 Vol. 142 (Japan) (Track 1).bin
/
tools
/
s_tool
/
move3.c
< prev
next >
Wrap
Text File
|
1999-06-03
|
10KB
|
513 lines
#include "JX250.H"
#include <sys\iocs.h>
#include <sys\dos.h>
#include <sys\scsi.h>
#include <stdio.h>
#include <stdlib.h>
/**********************************************************
フレームとマウスの関係
[rtn] -1 ; 違うところ
0 ; 中
bit 0 ; 上 bit 1 ; 左
bit 2 ; 右 bit 3 ; 下
**********************************************************/
int fream_mousepos(xx,yy)
int xx,yy;
{
int r;
r=0;
//--- 中
if ( xx<PreXV1-2 || xx>PreXV2+2 || yy<PreYV1-2 || yy>PreYV2+2 )
return(-1);
if ( xx<16-2 || xx>232+16+2 || yy<16-2 || yy>496+2 )
return(-1);
//--- 上チェック
if ( yy<PreYV1+6 ) r|=bit(0);
//--- 左チェック
if ( xx<PreXV1+6 ) r|=bit(1);
//--- 下チェック
if ( yy>PreYV2-6 ){
r&=nbit(0);
r|=bit(3);
}
//--- 右チェック
if ( xx>PreXV2-6 ){
r&=nbit(1);
r|=bit(2);
}
return( r );
}
/**********************************************************
ボタン
[in] x1,y1 = 画面の座標
x2,y2 =
[out] 0; 押された
-1; キャンセルされた
**********************************************************/
int sxbotton(x1,y1,x2,y2,mm)
int x1,y1,x2,y2,mm;
{
int i,j,m,n,x,y,b,rb;
int xx,yy;
int gz;
int ssp;
yy=( i=_ms_curgt_() )&0xFFFF;
xx=i>>16;
if ( xx<x1 || xx>=x2 || yy<y1 || yy>=y2 ){
// 範囲外
gz=0; // 0;押されている
j=-1;
} else {
gz=2; // 2;押されている
j=2;
}
rb=0;
m=(x2+7)/8;
n=(y2+7)/8;
for(;;){
_dos_change_pr();
yy=( i=_ms_curgt_() )&0xFFFF;
xx=i>>16;
if ( xx<x1 || xx>=x2 || yy<y1 || yy>=y2 ){
// 範囲外
if ( gz!=0 )
j=0;
} else {
// 範囲内
if ( gz==0 )
j=2;
}
if ( (b=MS_RSW())!=0 )
break;
if ( j>=0 ){
gz=j;
if ( mm==0 ){
ssp=_iocs_b_super(0);
for(y=y1/16;y<n;y++)
for(x=x1/16;x<m;x++)
if ( gz==0 ){
GGSP16_64_S(TADDS(x,y),MAP[x+y*32]);
} else{
GGICON_ON_S(TADDS(x,y)+32);
}
if ( ssp>0 )
_iocs_b_super(ssp);
} else {
GGREV(VADDS(0,x1,y1),(x2-x1)+1,(y2-y1)+1);
rb^=1;
}
j=-1;
}
b=MS_RSW();
if ( MS_LSW()==0 || b!=0 )
break;
}
if ( mm==0 ){
ssp=_iocs_b_super(0);
for(y=y1/16;y<n;y++)
for(x=x1/16;x<m;x++)
GGSP16_64_S(TADDS(x,y),MAP[x+y*32]);
if ( ssp>0 )
_iocs_b_super(ssp);
} else {
if ( rb!=0 )
GGREV(VADDS(0,x1,y1),(x2-x1)+1,(y2-y1)+1);
}
if ( gz==0 )
return(-1);
if ( b!=0 ){
while( MS_LSW()!=0 || MS_RSW()!=0 );
return(-1);
}
return(0);
}
/**********************************************************
数値加減(バー or ボタン)
[in] mx,my = 画面の座標
md= -1;バー 0;加減sw 1;減sw 2;増sw
nw = 現在の値
high,low = 変化出来る範囲
**********************************************************/
int kazu_move(mx,my,md,nw,low,high,sub)
int mx,my,md,nw,high,low;
void (*sub)();
{
int i,j,w,ct;
int xo,yo;
int onw;
int mxb,myb;
int xx,yy,b;
int ssp;
mxb=mx/16;
myb=my/16;
ct=0;
xo=-1;
yo=-1;
w=-1;
onw=nw;
//(*sub)(nw);
for(;;){
_dos_change_pr();
yy=( i=_ms_curgt_() )&0xFFFF;
xx=i>>16;
if ( md<0 ){
// バー
if ( xo!=xx || yo!=yy ){
xo=xx;
yo=yy;
i=xx-(mxb*16); // (0~62)
j=(high-low)+1;
nw=(i*j/62)+low;
if ( nw<low )
nw=low;
if ( nw>high )
nw=high;
CRTVDISP();
(*sub)(nw);
}
} else {
// ボタン
xo=xx;
yo=yy;
xx/=16;
yy/=16;
ONtim_set(1000);
if ( mxb==xx && myb==yy ){
if ( w!=1 ){
ssp=_iocs_b_super(0);
if ( md==0 ){
GGSP16_64_S(TADDS(mxb ,myb),0x76+1);
if ( md==0 ){
GGSP16_64_S(TADDS(mxb+1,myb),0x7E);
}
} else {
GGSP16_64_S(TADDS(mxb ,myb),MAP[mxb +myb*32]+1);
if ( md==0 ){
GGSP16_64_S(TADDS(mxb+1,myb),MAP[mxb+1+myb*32]);
}
}
if ( ssp>0 ) _iocs_b_super(ssp);
w=1;
}
if ( md==0 || md==1 ){
// 減
if ( low<nw ){
nw--;
CRTVDISP();
(*sub)(nw);
}
} else {
// 加
if ( high>nw ){
nw++;
CRTVDISP();
(*sub)(nw);
}
}
} elif ( md==0 && mxb+1==xx && myb==yy ){
// 加
if ( w!=2 ){
ssp=_iocs_b_super(0);
if ( md==0 ){
GGSP16_64_S(TADDS(mxb ,myb),0x76);
GGSP16_64_S(TADDS(mxb+1,myb),0x7E+1);
} else {
GGSP16_64_S(TADDS(mxb ,myb),MAP[mxb +myb*32]);
GGSP16_64_S(TADDS(mxb+1,myb),MAP[mxb+1+myb*32]+1);
}
if ( ssp>0 ) _iocs_b_super(ssp);
w=2;
}
if ( high>nw ){
nw++;
CRTVDISP();
(*sub)(nw);
}
} else {
// 位置がずれた
if ( w!=3 ){
ssp=_iocs_b_super(0);
if ( md==0 ){
GGSP16_64_S(TADDS(mxb ,myb),0x76);
if ( md==0 ){
GGSP16_64_S(TADDS(mxb+1,myb),0x7E);
}
} else {
GGSP16_64_S(TADDS(mxb ,myb),MAP[mxb +myb*32]);
if ( md==0 ){
GGSP16_64_S(TADDS(mxb+1,myb),MAP[mxb+1+myb*32]);
}
}
if ( ssp>0 ) _iocs_b_super(ssp);
w=3;
}
}
if ( ct==0 )
j=25;
elif ( ct<8 )
j=15;
elif ( ct<16 )
j=7;
else j=1;
ct++;
while( ONtim_count()<j ){
yy=( i=_ms_curgt_() )&0xFFFF;
//xx=i>>16;
}
}
b=MS_RSW();
if ( b!=0 )
break;
if ( MS_LSW()==0 )
break;
}
if ( md<0 ){
;
} else {
ssp=_iocs_b_super(0);
if ( md==0 ){
GGSP16_64_S(TADDS(mxb ,myb),0x76);
if ( md==0 )
GGSP16_64_S(TADDS(mxb+1,myb),0x7E);
} else {
GGSP16_64_S(TADDS(mxb ,myb),MAP[mxb +myb*32]);
if ( md==0 )
GGSP16_64_S(TADDS(mxb+1,myb),MAP[mxb+1+myb*32]);
}
if ( ssp>0 ) _iocs_b_super(ssp);
}
if ( b!=0 ){
//右クリック キャンセル
CRTVDISP();
(*sub)(onw);
while( MS_LSW()!=0 || MS_RSW()!=0 );
return(1);
}
return(0);
}
/**********************************************************
X のスクロールバー
fl= 全体の大きさ
bl= 物体の大きさ
ml= 物体の位置
**********************************************************/
void ScroolBarX(fl,bl,ml)
int fl,bl,ml;
{
int i,j;
struct _fillptr PP;
PP.y1=31*16+6;
PP.y2=31*16+10;
//-
if ( fl<=0 ){
// バー無し
PP.x1=32;
PP.x2=15*16-1;
PP.color=PalTable[0xD];
_iocs_fill(&PP); // 溝
return;
}
i=bl *(15*16-32)/fl;
j=ml *(15*16-32)/fl;
_iocs_window(32,0,15*16-1,511);
PP.x1=32;
PP.x2=32+j;
PP.color=PalTable[0xD];
_iocs_fill(&PP); // 溝
PP.x1=32+j;
PP.x2=32+j+i;
PP.color=PalTable[0xF];
_iocs_fill(&PP); // 溝
PP.x1=32+j+i;
PP.x2=15*16-1;
PP.color=PalTable[0xD];
_iocs_fill(&PP); // 溝
_iocs_window(0,0,511,511);
}
/**********************************************************
Y のスクロールバー
fl= 全体の大きさ
bl= 物体の大きさ
ml= 物体の位置
**********************************************************/
void ScroolBarY(fl,bl,ml)
int fl,bl,ml;
{
int i,j;
struct _fillptr PP;
PP.x1=6;
PP.x2=9;
//-
if ( fl<=0 ){
// バー無し
PP.y1=32;
PP.y2=30*16-1;
PP.color=PalTable[0xD];
_iocs_fill(&PP); // 溝
return;
}
i=bl *(30*16-32)/fl;
j=ml *(30*16-32)/fl;
_iocs_window(0,32,511,30*16-1);
PP.y1=32;
PP.y2=32+j;
PP.color=PalTable[0xD];
_iocs_fill(&PP); // 溝
PP.y1=32+j;
PP.y2=32+j+i;
PP.color=PalTable[0xF];
_iocs_fill(&PP); // 溝
PP.y1=32+j+i;
PP.y2=30*16-1;
PP.color=PalTable[0xD];
_iocs_fill(&PP); // 溝
_iocs_window(0,0,511,511);
}
/**********************************************************
マウスボタン判定
**********************************************************/
int MS_LSW()
{
return( (_iocs_ms_getdt()&bit(8)) );
}
/*+++*/
int MS_LSW2(){
return( ((_iocs_ms_getdt()&bit(8))!=0)?-1:0 );
}
/*+++*/
int MS_RSW(){
return( ((_iocs_ms_getdt()&bit(0))!=0)?-1:0 );
}
/**********************************************************
G
**********************************************************/
void GraphicV(mo)
int mo;
{
int o;
o=B_WPEEK((void*)0xe82600);
if ( mo==0 ){
// 見えなくする
B_WPOKE((void*)0xe82600,o&0xfff0);
} else {
// 見える
B_WPOKE((void*)0xe82600,o|0x000f);
}
}
/**********************************************************
TEXT VRAM クリア
[in] m= 0 ; 見えるところだけ
1 ; 全部
**********************************************************/
void TXCLS(m)
int m;
{
int i,x,y;
int *a1,*a2,*a3,*a4;
int ssp;
ssp=_iocs_b_super(0);
if ( m==0 ){
for(y=0;y<512;y++){
a1=(void*)(0xE00000+y*128);
a2=(void*)(0xE20000+y*128);
a3=(void*)(0xE40000+y*128);
a4=(void*)(0xE60000+y*128);
for(x=0;x<128/4;x++){
*a1++=0;
*a2++=0;
*a3++=0;
*a4++=0;
}
}
} elif ( m==1 ){
a1=(void*)0xE00000;
for(i=0;i<0x80000/4;i++)
*a1++=0;
}
if ( ssp>=0 )
_iocs_b_super(ssp);
}
/******************************************
画面比設定
*******************************************/
void AspScreen()
{
int ssp;
_iocs_crtmod(0x100+12);
if ( AspMode!=0 ){ // 「画像」の 0;(2:3) 1;(1:1)
ssp=_iocs_b_super(0);
*(char *)0xe80029=(char)0x16; //CRTC-R20
*(char *)0xe80001=(char)0x89; //CRTC-R00
*(char *)0xe80003=(char)0x0e; //CRTC-R01
*(char *)0xe80005=(char)0x1c+0x10; //CRTC-R02
*(char *)0xe80007=(char)0x5c+0x10; //CRTC-R03
if ( ssp>0 )
_iocs_b_super(ssp);
}
return;
}
/*+*****************************************
マウス座標とか
********************************************/
UNint _ms_curgt_()
{
static int tm=0;
static short cc=-1;
static UNshort ss[]={ RGB(31,31,31),
RGB(29,29,29),
RGB(27,27,27),
RGB(25,25,25),
RGB(23,23,23),
RGB(25,25,25),
RGB(27,27,27),
RGB(29,29,29)
};
if ( cc<0 ){
cc=0;
tm=_iocs_ontime();
}
if ( (_iocs_ontime()-tm)>8 ){
tm=_iocs_ontime();
CRTVDISP();
_iocs_tpalet(3,ss[cc]);
// _iocs_tpalet(8,ss[cc]);
cc=(cc+1)&7;
}
return( _iocs_ms_curgt() );
}
/*+*****************************************
ロゴ設定
********************************************/
void JxLogoChain()
{
int i,j,m,n,x,y;
UNchar *ss;
UNchar *a,*b;
UNchar *G,*T;
extern int GGSP16_64_BUFF;
extern int TTL_DATA;
G=GGSP16_64_BUFF;
T=TTL_DATA;
if ( jxscanner==_JX250_ ){
ss=&T[0];
} elif ( jxscanner==_JX350_ ){
ss=&T[128*4];
} elif ( jxscanner==_JX330_ ){
ss=&T[128*8*4];
} elif ( jxscanner==_JX325_ ){
ss=&T[128*4+128*8*4];
} elif ( jxscanner==_JX270_ ){
ss=&T[128*16*4];
} else {
return;
}
for(y=0;y<4;y++){
a=&G[(0xd3+8*y)*128];
b=&ss[(8*y)*128];
for(x=0;x<128*4;x++)
*a++=*b++;
}
return;
}